/**
 * Created by DuHuiling on 2017/4/25.
 */
var Password = require('../../../../src/libs/password');
var FormItem = require('../../../../src/libs/form-item');
var Input = require('../../../../src/libs/input');
var GetCode = require('../../../../src/libs/get-code');
var ChangePwd = React.createClass({
    getDefaultProps:function(){
        return{
            title:this.props.title,
            warmTips:this.props.warmTips?this.props.warmTips:""
        }
    },
    componentDidMount:function(){
        var _this = this;
        UEventHub.on('getcode',function(v){
            //console.log(v)
            if(v == _this.props.getCode){
                _this.refs[_this.props.ref].toCount();
            }
        }.bind(this));
    },
    render:function(){
        return(
            <div>
                <div className="alert-title"><b></b>{this.props.title}<b></b></div>
                <div className="alert-content">
                    {this.props.warmTips ?
                        <div className="tips fc-main"><i className="iconfont icon-tips"></i>{this.props.warmTips}</div> : ""
                    }
                    <div className="form">
                        <FormItem label={this.props.oldPwd.label} id={this.props.oldPwd.id} dmbind={this.props.oldPwd.dmbind}>
                            <Password className="ucs-input" name={this.props.oldPwd.name} placeholder={this.props.oldPwd.placeholder} dmbind={this.props.oldPwd.dmbind}/>
                        </FormItem>
                        <FormItem label={this.props.newPwd.label} id={this.props.newPwd.id} dmbind={this.props.newPwd.dmbind}>
                            <Password className="ucs-input" name={this.props.newPwd.name} placeholder={this.props.newPwd.placeholder} dmbind={this.props.newPwd.dmbind}/>
                        </FormItem>
                        <FormItem label={this.props.checkNewPwd.label} id={this.props.checkNewPwd.id} dmbind={this.props.checkNewPwd.dmbind}>
                            <Password className="ucs-input" name={this.props.checkNewPwd.name} placeholder={this.props.checkNewPwd.placeholder} dmbind={this.props.checkNewPwd.dmbind}/>
                        </FormItem>
                        <FormItem label={this.props.phoneCode.label} id={this.props.phoneCode.id} name={this.props.phoneCode.name} dmbind={this.props.phoneCode.dmbind}>
                            <input id={this.props.phoneCode.id} name={this.props.phoneCode.name} className="ucs-input ucs-input-code" placeholder={this.props.phoneCode.placeholder} value={this.props.phoneCode.value} dmbind={this.props.phoneCode.dmbind}/>
                            <GetCode ref={this.props.ref} className="btn btn-code" count={this.props.getCode.count} onClick={this.props.getCode.onClick}/>
                            {/*<button id={PageDM.getBtnCode.id} ref="getcode" name={PageDM.getBtnCode.name} className="btn-code btn ucs-btn" onclick={this._getCoce.bind(this,"getBtnCode","getcode")}>获取验证码</button>*/}
                        </FormItem>
                    </div>
                </div>
            </div>
        )
    }
});
module.exports = ChangePwd;